package com.bootdo.analyze.service.impl;

import com.bootdo.analyze.dao.ClientSellAIDao;
import com.bootdo.analyze.dao.SellOrderDao;
import com.bootdo.analyze.domain.ClientSellAIDO;
import com.bootdo.analyze.domain.SellOrderDO;
import com.bootdo.analyze.service.ClientSellAIService;
import com.bootdo.analyze.service.SellOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class SellOrderServiceImpl implements SellOrderService {
    @Autowired
    private SellOrderDao sellOrderDao;


    @Override
    public int count(Map<String, Object> map) {
        return sellOrderDao.count(map);
    }

    @Override
    public List<SellOrderDO> getSellOrder(Map<String, Object> map) {
        return sellOrderDao.getSellOrder(map);
    }

    @Override
    public List<SellOrderDO> getSellReport(Map<String, Object> map) {
        List<SellOrderDO> sellOrderDOList = sellOrderDao.getSellReport(map);
        SellOrderDO sellOrderDO1 = sellOrderDao.getSellTO(map);
        if (sellOrderDOList.size()!=0){
            for (SellOrderDO sellOrderDO : sellOrderDOList){
                sellOrderDO.setTotalamountTO(sellOrderDO1.getTotalamountTO());
                sellOrderDO.setSalesquantityTO(sellOrderDO1.getSalesquantityTO());
            }
        }

        return sellOrderDOList;
    }
}
